package com.codeoss.framework.view.datasource.store;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

import com.codeoss.framework.view.datasource.IDataSource;

@Service
public class DataSourceStore implements IDataSourceStore,ApplicationContextAware {
    private ApplicationContext applicationContext;
    
	@Override
	public IDataSource getDataSource(String type) {
		// TODO Auto-generated method stub
		IDataSource dataSource=(IDataSource)applicationContext.getBean(type+"DataSource");
		return dataSource;
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		// TODO Auto-generated method stub
		this.applicationContext=applicationContext;
	}

}
